<html>
<head>
<title>测试用</title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>


</head>
<body>
	<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
	  <legend>测试工具</legend>
	</fieldset>   
	<input id="org_id" type="text" name="orgid" style="display:none"></input>
	<div style="padding: 20px; background-color: #F2F2F2;">
	  <div class="layui-row layui-col-space15">
	    <div class="layui-col-md12">
	      <div class="layui-card">
	        <div class="layui-card-header">添加测试锁具</div>
	        <div class="layui-card-body">
			      <table style="width:100%">
			      	<tr>
			      		<td>起始序列号:</td>
			      		<td><input type="text" id="locksn" class="layui-input" value=""></td>
			      		<td>添加数量:</td>
			      		<td><input type="text" id="addnumber" class="layui-input" value=""></td>
			      		<td>添加至:</td>
			      		<td><input type="button" id="f_orgname" onclick="dialog_orgselect()" class="layui-input" style="text-align: left;width:200px" ></td>
			      		<td><button id="btn_lockadd" class="layui-btn layui-btn-sm"><i class="layui-icon layui-icon-add-circle"></i> 添加</button></td>
			      	</tr>
			      	
			      </table>
	        </div>
	      </div>
	    </div>
	    
	    <div class="layui-col-md12">
	      <div class="layui-card">
	        <div class="layui-card-header">标题</div>
	        <div class="layui-card-body">
	          内容
	        </div>
	      </div>
	    </div>
	  </div>
	</div> 
</body>
<script type="text/javascript">
layui.use([], function(){
	$('#btn_lockadd').click(function(){
		debugger;
		var datastring = '{"locksn":"' + $('#locksn').val() + '","number":' + $('#addnumber').val() + ',"orgid":"' + $('#org_id').val() + '"}';

		$.ajax({
			type:"post",
			contentType: "application/json;charset=UTF-8",
			url: "addtestlock.do?",
			async:false,
			data:datastring,
	     	dataType:"json",
	        success: function(msg) {    //数据提交成功时返回数据
	        	//debugger;
	        	if(msg.status == "1"){
	        		layer.msg(msg.desc);
	        	}else{
	        		layer.msg(msg.desc);
	        	}						
	        },
	        error : function(e){
	            alert(e.status);
	            alert(e.responseText);
	        }

		});		
	});

	
});

function dialog_orgselect(){
	layer.open({
		  type: 2 //0（信息框，默认）1（页面层）2（iframe层）3（加载层）4（tips层） 
		  ,title: "选择机构" //标题
		  ,skin:"layui-layer-lan"   //layui-layer-lan:蓝色，layui-layer-molv：墨绿色，默认灰色
		  ,area: ['350px', '400px'] //宽度、高度
		  ,shade: 0.3
		  ,offset: 'auto'
		  ,anim:5 //弹出动画
		  ,shadeClose: false //弹框出现后，允许点击其它地方关闭
		  ,content: 'getorgtree.html'     //内容
		  ,btn: ['取消'] //只是为了演示		
		  ,success:function (layero,index) {
			  debugger;
              var iframe = window['layui-layer-iframe' + index];              
              iframe.child("test_org","porg");
      	  }
		  ,yes: function(index, layero){
		    //按钮【按钮一】的回调
			 	 //$("#orgtree").css('display','none'); 
			 	layer.close(index);
		  }
		  ,cancel: function(index,layero){ 
			    //右上角关闭回调
			    //$("#orgtree").css('display','none'); 
		 }
       });
}
</script>
</html>